<#include "../common/layout/__mainlayout.html">
<#include "../common/__pagination.html">

<!-- page specific plugin styles -->
        <!--设置面包屑-->
        <#assign pageBreadCrumbs>
            <li class="active"><a href="#">上传&审核</a></li>
            <li class="active">审核内容详情</li>
        </#assign>


        <#assign pageCss>
            <!-- page specific plugin styles -->
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/chosen.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css"/>
        </#assign>

        <#assign pageJavascript>
        <script src="${ctx}/static/admin/assets/js/jquery.dataTables.js"></script>
        <script src="${ctx}/static/admin/assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="${ctx}/static/admin/assets/js/ajaxfileupload.js"></script>
        <script src="${ctx}/static/admin/assets/js/bootstrap-wysiwyg.js"></script>

        <script type="text/javascript">
            var $path_assets = "${ctx}/static/admin/assets/";//this will be used in loading jQuery UI if needed!
        </script>
        <script type="text/javascript">
            jQuery(function($){
                //初始化数据展示
                $("#isAccredit").val(${vo.isAccredit!});
                $("#sysStarsEnable").val(${vo.sysStarsEnable!});
                $("#sysStars").val(${vo.sysStars!});
                $("#commentStars").val(${vo.commentStars!});
                $("#isOfficial").val(${vo.isOfficial!});
                $("#categoryId").val(${vo.categoryId!});
                $("#categoryId2").val(${vo.categoryId2!});
                $("#categoryId3").val(${vo.categoryId3!});
                $("#language").val(${vo.language!});
                $("#isLastVersion").val(${vo.isLastVersion!});
                $("#adState").val(${vo.adState!});
                $("#safeState").val(${vo.safeState!});
                $("#payType").val(${vo.payType!});
                $("#firstPublish").val(${vo.firstPublish!});
                $("#softSrc").val(${vo.softSrc!});

                var intvalue = "${vo.deviceTypeList!}";
                $("#deviceTypeList").val(intvalue);
                intvals = intvalue.split(",");
                for( i=0;i<intvals.length;i++){
                    if(intvals[i]!=""){
                        o = $("#deviceType option[value="+intvals[i]+"]").attr("selected", "selected");
                    }
                }


                if(!ace.vars['touch']) {
                    $('.chosen-select').chosen({allow_single_deselect:true});
                    //resize the chosen on window resize

                    $(window)
                            .off('resize.chosen')
                            .on('resize.chosen', function() {
                                $('.chosen-select').each(function() {
                                    var $this = $(this);
                                    $this.next().css({'width': $this.parent().width()});
                                })
                            }).trigger('resize.chosen');
                    //resize chosen on sidebar collapse/expand
                    $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
                        if(event_name != 'sidebar_collapsed') return;
                        $('.chosen-select').each(function() {
                            var $this = $(this);
                            $this.next().css({'width': $this.parent().width()});
                        })
                    });


                    $('#chosen-multiple-style .btn').on('click', function(e){
                        var target = $(this).find('input[type=radio]');
                        var which = parseInt(target.val());
                        if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
                        else $('#form-field-select-4').removeClass('tag-input-style');
                    });
                }

                $("#categoryId").change(function () {
                    //清除二级下拉列表
                    $("#categoryId2").empty();
                    $("#categoryId3").empty();
                    if($(this).val() !=0){

                        $("#categoryId2").append($("<option/>").text("--请选择二级分类--").attr("value","0"));
                        //要请求的二级下拉JSON获取页面
                        var url="${ctx}/admin/category/categoryList.do";
                        //将选中的一级下拉列表项的id传过去
                        $.getJSON(url, { parentId:$(this).val() },function (data) {
                            //对请求返回的JSON格式进行分解加载
                            $(data.data).each(function () {
                                $("#categoryId2").append($("<option/>").text(this.categoryName).attr("value",this.id));
                            });
                        });
                    }
                });

                $("#categoryId2").change(function () {
                    //清除二级下拉列表
                    $("#categoryId3").empty();
                    if($(this).val() !=0){
                        $("#categoryId3").append($("<option/>").text("--请选择三级分类--").attr("value","0"));
                        //要请求的二级下拉JSON获取页面
                        var url="${ctx}/admin/category/categoryList.do";
                        //将选中的一级下拉列表项的id传过去
                        $.getJSON(url, { parentId:$(this).val() },function (data) {
                            //对请求返回的JSON格式进行分解加载
                            $(data.data).each(function () {
                                $("#categoryId3").append($("<option/>").text(this.categoryName).attr("value",this.id));
                            });
                        });
                    }

                });

                $("#bootbox-checkno").on(ace.click_event, function() {
                    bootbox.prompt("请填写不通过原因", function(result) {
                        if (result === null) {

                        } else {
                            if(result==""){
                                alert("请填写不通过原因");
                                return false;
                            }
                            $("#checkReason").val(result);
                            var softItemId = ${vo.softItemId!};
                            var url = "${ctx}/admin/soft/checkNoItem.do?id="+softItemId+"&checkReason="+result;
                            $.get(url, { },function(data){
                                if(data){
                                    window.location="${refer!}";
                                }
                            });
                        }
                    });
                });

                $("#bootbox-cancel").click(function(){
                    window.location="${refer!}";
                });


                function showErrorAlert (reason, detail) {
                    var msg='';
                    if (reason==='unsupported-file-type') { msg = "Unsupported format " +detail; }
                    else {
                        //console.log("error uploading file", reason, detail);
                    }
                    $('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button>'+
                    '<strong>File upload error</strong> '+msg+' </div>').prependTo('#alerts');
                }

                $('#descriptiondiv').ace_wysiwyg({
                    toolbar:
                            [
                                'font',
                                null,
                                'fontSize',
                                null,
                                {name:'bold', className:'btn-info'},
                                {name:'italic', className:'btn-info'},
                                {name:'strikethrough', className:'btn-info'},
                                {name:'underline', className:'btn-info'},
                                null,
                                {name:'insertunorderedlist', className:'btn-success'},
                                {name:'insertorderedlist', className:'btn-success'},
                                {name:'outdent', className:'btn-purple'},
                                {name:'indent', className:'btn-purple'},
                                null,
                                {name:'justifyleft', className:'btn-primary'},
                                {name:'justifycenter', className:'btn-primary'},
                                {name:'justifyright', className:'btn-primary'},
                                {name:'justifyfull', className:'btn-inverse'},
                                null,
                                {name:'createLink', className:'btn-pink'},
                                {name:'unlink', className:'btn-pink'},
                                null,
                                {name:'insertImage', className:'btn-success'},
                                null,
                                'foreColor',
                                null,
                                {name:'undo', className:'btn-grey'},
                                {name:'redo', className:'btn-grey'}
                            ],
                    'wysiwyg': {
                        fileUploadError: showErrorAlert
                    }
                }).prev().addClass('wysiwyg-style2');

                $("#softItemForm").validate({
                    errorElement: 'div',
                    errorClass: 'help-block',
                    focusInvalid: true,
                    highlight: function (e) {
                        $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
                    },
                    success: function (e) {
                        $(e).closest('.form-group').removeClass('has-error');//.addClass('has-info');
                        $(e).remove();
                    },
                    errorPlacement: function (error, element) {
                        if (element.is('input[type=checkbox]') || element.is('input[type=radio]')) {
                            var controls = element.closest('div[class*="col-"]');
                            if (controls.find(':checkbox,:radio').length > 1) controls.append(error);
                            else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
                        }
                        else if (element.is('.select2')) {
                            error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
                        }
                        else if (element.is('.chosen-select')) {
                            error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
                        }
                        else error.insertAfter(element.parent());
                    },

                    submitHandler: function (form) {
                        $.ajax({
                            cache: true,
                            type: "POST",
                            url:"${ctx}/admin/soft/save.do",
                            data:$('#softItemForm').serialize(),// 你的formid
                            async: false,
                            error: function(request) {
                                alert("Connection error");
                            },
                            success: function(data) {
                                if(data.result == "success"){
                                    window.location="${refer!}";
                                }else{
                                    alert(data.messages);
                                }
                            }
                        });
                    },
                    invalidHandler: function (form) {
                    }
                });
            })
        </script>

        <script type="text/javascript">

            function uploadIconFile(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadIconFile.do?inputName=iconFile",            //需要链接到服务器地址
                    dataType : 'text/html',
                    fileElementId:'id-input-icon',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            $("#icon512").attr("src","${staticHost}"+upload.icon512Url);
                            $("#icon512a").attr("href","${staticHost}"+upload.icon512Url);
                            $("#icon125").attr("src","${staticHost}"+upload.icon125Url);
                            $("#icon125a").attr("href","${staticHost}"+upload.icon125Url);
                            $("#icon114").attr("src","${staticHost}"+upload.icon114Url);
                            $("#icon114a").attr("href","${staticHost}"+upload.icon114Url);
                            $("#icon62").attr("src","${staticHost}"+upload.icon62Url);
                            $("#icon62a").attr("href","${staticHost}"+upload.icon62Url);
                            $("#iconUrl").val(upload.iconUrl);
                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请重新上传");
                    }
                });
            }

            function uploadAdFile(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadAdFile.do?inputName=adFile",            //需要链接到服务器地址
                    dataType : 'text',
                    fileElementId:'id-input-ad',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            $("#ad").attr("src","${staticHost}"+upload.adUrl);
                            $("#ada").attr("href","${staticHost}"+upload.adUrl);
                            $("#adthumb").attr("src","${staticHost}"+upload.adThumbUrl);
                            $("#adthumba").attr("href","${staticHost}"+upload.adThumbUrl);
                            $("#adIconUrl").val(upload.adUrl);
                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请重新上传");
                    }
                });
            }

            function uploadScreenShot(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadScreenShot.do?inputName=screenshotFile",            //需要链接到服务器地址
                    dataType : 'text',
                    fileElementId:'id-input-screenshot',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            liString = '<li>'
                            +'<a href="'+"${staticHost}"+upload.screenUrl+'" data-rel="colorbox">'
                            +'<img width="150" height="150" alt="62*62" src="'+"${staticHost}"+upload.screenUrl+'" />'
                            +'</a>'
                            +'<input id="screenshotId" name="screenshotId" type="hidden" value="'+upload.id+'"/>'
                            +'<input id="screenshotUrl" name="screenshotUrl" type="hidden" value="'+upload.screenUrl+'"/>'
                            +'<div class="tools tools-bottom">'
                            +'<a onclick="delScreenshot(this)"> <i class="ace-icon fa fa-times red"></i></a>'
                            +'</div>'
                            +'</li>';
                            $("#screenshotul").append(liString);
                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请重新上传");
                    }
                });
            }

            function delScreenshot(image){
                bootbox.confirm({
                            message: "确定删除该截图?",
                            buttons: {
                                confirm: {
                                    label: "确定",
                                    className: "btn-primary btn-sm"
                                },
                                cancel: {
                                    label: "取消",
                                    className: "btn-sm"
                                }
                            },
                            callback: function(result) {
                                if(result){
                                    screenshotSoftItemId = $(image).parent().parent().children("#screenshotSoftItemId").val();
                                    if(screenshotSoftItemId!=""){
                                        $.get("${ctx}/admin/soft/delScreenshot.do", { id: screenshotSoftItemId},function(data){
                                            $(image).parent().parent().remove();
                                        });
                                    }else{
                                        $(image).parent().parent().remove();
                                    }
                                }
                            }
                        }
                );
            }

            function submitSoft(submitType){
                if(submitType ==3)$("#checkReason").val("");
                var categoryId = $("#categoryId").val();
                if(categoryId == 0){
                    alert("请选择分类");
                    return false;
                }
                var screenShotLength = $("#screenshotul").children().length;
                if(screenShotLength<2 && screenShotLength >5){
                    alert("请上传2-5张软件截图");
                    return false;
                }
                $("#submitType").val(submitType);
                $("#description").val($("#descriptiondiv").html());
                //处理设备多选
                o = document.getElementById("deviceType");
                t = document.getElementById("deviceTypeList");
                var intvalue="";
                for(i=0;i<o.length;i++){
                    if(o.options[i].selected){
                        intvalue+=o.options[i].value+",";
                    }
                }
                t.value=intvalue.substr(0,intvalue.length-1);
                $('#softItemForm').submit();
            }

            $('#id-input-apk,#id-input-icon,#id-input-gamecut,#id-input-ad,#id-input-screenshot').ace_file_input({
                no_file:'未选择文件 ...',
                btn_choose:'浏览',
                btn_change:'更改',
                droppable:false,
                onchange:null,
                thumbnail:false //| true | large
                //whitelist:'gif|png|jpg|jpeg'
                //blacklist:'exe|php'
                //onchange:''
                //
            });
        </script>
        </#assign>
    <@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript currentMenu="ApplicationFlag">
    <form id="softItemForm" class="form-horizontal" action="${ctx}/admin/soft/save.do" method="post">
        <!--上传APK块---->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传应用</h4>

                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-1" for="softId">应用地址:</label>
                                <div class="col-xs-12 col-sm-6 control-label" style="text-align: left;">
                                    ${vo.fileUrl!}

                                </div>
                                <div class="col-xs-12 col-sm-4 ">
                                    <a   class="btn btn-sm btn-success col-xs-4" href="${ctx}/admin/upload/download.do?path=${vo.fileUrl!}">
                                        下载 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!--上传ICON块---->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传图标(512x512.png)</h4>

                    </div>
                    <#if !readonly??>
                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <div class="col-xs-8">
                                        <!-- #section:custom/file-input -->
                                        <input type="file" id="id-input-icon" name="iconFile" value="${vo.iconFile!}"/>
                                        <input id="iconUrl" name="iconUrl" type="hidden" value="${vo.iconUrl!}"  class="required"/>
                                    </div>
                                    <button type="button" id="id-button-icon" class="btn btn-sm btn-success" onclick="uploadIconFile()">
                                        上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <div class="widget-body">
                        <div class="widget-main">
                            <div>
                                <ul class="ace-thumbnails clearfix">

                                    <li><a id="icon512a" name="icon512a" data-rel="colorbox" href="${staticHost}${vo.icon512Url!}">
                                        <img id="icon512" name="icon512" width="256" height="256"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" src="${staticHost}${vo.icon512Url!}" />
                                        </a>
                                    </li>
                                    <li><a id="icon125a" name="icon125a" data-rel="colorbox" href="${staticHost}${vo.icon125Url!}">
                                        <img id="icon125" name="icon125" width="62" height="62"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'"  src="${staticHost}${vo.icon125Url!}" />
                                    </a>
                                    </li>
                                    <li><a id="icon114a" name="icon114a" data-rel="colorbox" href="${staticHost}${vo.icon114Url!}">
                                        <img id="icon114" name="icon114" width="57" height="57"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'"  src="${staticHost}${vo.icon114Url!}" />
                                    </a>
                                    </li>
                                    <li><a id="icon62a" name="icon62a" data-rel="colorbox" href="${staticHost}${vo.icon62Url!}">
                                        <img id="icon62" name="icon62" width="31" height="31"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'"  src="${staticHost}${vo.icon62Url!}" />
                                    </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!----上传广告图-------->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传广告图</h4>

                    </div>
                    <#if !readonly??>
                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <div class="col-xs-8">
                                        <!-- #section:custom/file-input -->
                                        <input type="file" id="id-input-ad" name="adFile"/>
                                    </div>
                                    <button type="button" id="id-button-ad" class="btn btn-sm btn-success" onclick="uploadAdFile()">
                                        上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                    </button>

                                </div>
                            </div>
                        </div>
                    </#if>
                    <div class="widget-body">
                        <div class="widget-main">
                            <div>
                                <ul class="ace-thumbnails clearfix">

                                    <li><a id="ada" name="ada" data-rel="colorbox" href="${staticHost}${vo.adIconUrl!}">
                                        <img id="ad" name="ad" width="150"   onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" src="${staticHost}${vo.adIconUrl!}"/>
                                    </a>
                                    </li>
                                    <li><a id="adthumba" name="adthumba" data-rel="colorbox" href="${staticHost}${vo.adThumbUrl!}">
                                        <img id="adthumb" name="adthumb" width="80"   onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'"  src="${staticHost}${vo.adThumbUrl!}"/>
                                    </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!----上传截图块-------->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传软件截图</h4>

                    </div>

                    <#if !readonly??>
                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <div class="col-xs-8">
                                        <!-- #section:custom/file-input -->
                                        <input type="file" id="id-input-screenshot" name="screenshotFile" id="id-input-screenshot" />
                                    </div>
                                    <button type="button" id="id-button-screenshot" class="btn btn-sm btn-success" onclick="uploadScreenShot()">
                                        上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <div class="widget-body">
                        <div class="widget-main">
                            <div>
                                <ul id="screenshotul" class="ace-thumbnails clearfix">
                                    <#if vo.screenShots?? >
                                        <#list vo.screenShots as ss>
                                            <li><a data-rel="colorbox" href="${staticHost}${ss.screenUrl!}">
                                                <img width="150" height="150" src="${staticHost}${ss.screenUrl!}"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'"></a>
                                                <input type="hidden" value="5" name="screenshotId" id="screenshotId" value="${ss.id!}">
                                                <input type="hidden" value="${ss.screenUrl!}" name="screenshotUrl" id="screenshotUrl">
                                                <div class="tools tools-bottom">
                                                    <a onclick="delScreenshot(this)">
                                                        <i class="ace-icon fa fa-times red"></i>
                                                    </a>
                                                </div>
                                            </li>
                                        </#list>
                                    </#if>

                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


            <!---软件信息----->
            <div class="row">
                <div class="col-sm-12">
                    <div class="widget-box">
                        <div class="widget-header">
                            <h4 class="widget-title">软件信息</h4>

                        </div>

                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="softId">软件编号:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="softId" id="softId" class="form-control col-sm-4 required" value="${vo.softId!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="lastSoftItemId">最新版本:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="lastSoftItemId" id="lastSoftItemId" class="form-control col-sm-4" value="${vo.lastSoftItemId!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="packageName">软件包名:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="packageName" id="packageName" class="form-control col-sm-4 required" value="${vo.packageName!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="softName">软件名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="softName" id="softName" <#if readonly?? >readonly=""</#if> class="form-control col-sm-4 required" value="${vo.softName!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="isAccredit">是否授权:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="isAccredit" id="isAccredit" data-placeholder="Choose a State..."  <#if readonly?? >readonly=""</#if> >
                                                    <option value="1" >是</option>
                                                    <option value="0" >否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="sysStarsEnable">开启星级:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class=" form-control" name="sysStarsEnable" id="sysStarsEnable"  data-placeholder="Choose a State..." <#if readonly?? >readonly=""</#if> >
                                                    <option value="0">关闭</option>
                                                    <option value="1">开启</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="sysStars">系统星级:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="sysStars" id="sysStars"  <#if readonly?? >readonly=""</#if>  data-placeholder="Choose a star...">
                                                    <option value=""></option>
                                                    <#list starEnums?keys as key>
                                                        <option value="${starEnums[key]?default('')}">${key}</option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="commentStars">评论星级:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="commentStars" id="commentStars" <#if readonly?? >readonly=""</#if>   data-placeholder="Choose a star...">
                                                    <option value=""></option>
                                                    <#list starEnums?keys as key>
                                                        <option value="${starEnums[key]?default('')}">${key}</option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="isOfficial">是否官方:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="isOfficial" id="isOfficial" <#if readonly?? >readonly=""</#if>  data-placeholder="Choose a State...">
                                                    <option value="1">是</option>
                                                    <option value="0">否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="downloadNumber">总下载量:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="number" name="downloadNumber" id="downloadNumber" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4" value="${vo.downloadNumber!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="seo">搜索关键词（用空格隔开）:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="seo" id="seo"  <#if readonly?? >readonly=""</#if> class="form-control col-sm-4 required" value="${vo.seo!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="developerName">开发者名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerName" id="developerName" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 " value="${vo.developerName!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="developerPhone">开发者手机/电话:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerPhone" id="developerPhone" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 " value="${vo.developerPhone!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="developerEmail">开发者邮箱:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerEmail" id="developerEmail" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 " value="${vo.developerEmail!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="developerSite">开发者网站:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerSite" id="developerSite" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 " value="${vo.developerSite!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="categoryId">软件分类:</label>
                                    <div class="col-xs-12 col-sm-3">
                                        <div class="clearfix">
                                            <div>
                                                <select class=" form-control" name="categoryId" id="categoryId" <#if readonly?? >readonly=""</#if>  data-placeholder="请选择一级分类">
                                                <option value="0">--请选择一级分类--</option>
                                                <#list firstCatagories as first>
                                                    <option value="${first.id}" >
                                                        ${(first.categoryName)!}
                                                    </option>
                                                </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-xs-12 col-sm-3">
                                        <div class="clearfix">
                                            <div>
                                                <select class=" form-control" name="categoryId2" id="categoryId2" <#if readonly?? >readonly=""</#if>  data-placeholder="请选择二级分类">
                                                <option value="0">请选择二级分类</option>
                                                <#if secondCatagories??>
                                                    <#list secondCatagories as sec>
                                                        <option value="${sec.id}" >
                                                            ${(sec.categoryName)!}
                                                        </option>
                                                    </#list>
                                                </#if>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-xs-12 col-sm-3">
                                        <div class="clearfix">
                                            <div>
                                                <select class=" form-control" name="categoryId3" id="categoryId3" <#if readonly?? >readonly=""</#if>  data-placeholder="请选择三级分类">
                                                <option value="0">请选择三级分类</option>
                                                <#if thirdCatagories??>
                                                    <#list thirdCatagories as third>
                                                        <option value="${third.id}" >
                                                            ${(third.categoryName)!}
                                                        </option>
                                                    </#list>
                                                </#if>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <div>
                                        <label class="control-label col-xs-12 col-sm-2" for="summary">软件简介:</label>
                                        <div class="control-label col-xs-10 col-sm-10 " >
                                            <textarea class=" col-sm-10 limited required" id="summary" name="summary" <#if readonly?? >readonly=""</#if>  maxlength="500">${vo.summary!}</textarea>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="descriptiondiv">软件详细内容:</label>
                                    <div class="col-sm-10 " >
                                        <#if !readonly?? >
                                            <div class="wysiwyg-editor " id="descriptiondiv" name="descriptiondiv"  style="border:1px solid #d5d5d5">${vo.description!}</div>
                                        <#else>
                                            <div  name="descriptiondiv"  style="border:1px solid #d5d5d5" >${vo.description!}</div>
                                        </#if>
                                        <textarea hidden="hidden" id="description" name="description">${vo.description!}</textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <!---版本信息----->
            <div class="row">
                <div class="col-sm-12">
                    <div class="widget-box">
                        <div class="widget-header ">
                            <h4 class="widget-title">版本信息</h4>
                        </div>
                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="softItemId">软件版本编号:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="softItemId" id="softItemId" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 required" value="${vo.softItemId!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2" for="itemName">软件具体名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="itemName" id="itemName" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 required" value="${vo.itemName!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="versionCode">版本号:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text"  name="versionCode" id="versionCode" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 required" value="${vo.versionCode!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="versionName">版本名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text"  name="versionName" id="versionName"    <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 required" value="${vo.versionName!}"/>
                                        </div>
                                    </div>

                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="fileSize">软件大小:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="fileSize" id="fileSize" <#if readonly?? >readonly=""</#if>  class="form-control col-sm-4 required" value="${vo.fileSize!}"/>
                                            <input id="fileUrl" name="fileUrl" type="hidden" value="${vo.fileUrl!}"/>
                                            <input id="fileMD5" name="fileMD5" type="hidden" value="${vo.fileMD5!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2" for="deviceTypeList">支持的设备类型:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">

                                            <#if readonly?? >
                                                <#assign terminalNames><#list terminals as t>${t.terminalName!}&nbsp;&nbsp;</#list></#assign>
                                                <input type="text"  class="form-control col-sm-4 " readonly="" value="${terminalNames}"/>
                                                <#else>
                                                    <select multiple="" class="chosen-select form-control" name="deviceType"
                                                            id="deviceType" data-placeholder="Choose a State...">
                                                        <#list terminals as t>
                                                            <option value="${t.itemValue}" >
                                                                ${(t.itemTitle)!}
                                                            </option>
                                                        </#list>
                                                    </select>
                                            </#if>

                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">

                                    <label class="control-label col-xs-12 col-sm-2" for="language">语言:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="language" id="language"  <#if readonly?? >readonly=""</#if> data-placeholder="Choose a State...">
                                                    <#list languages as lang>
                                                        <option value="${lang.itemValue}" >
                                                            ${(lang.itemTitle)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2" for="isLastVersion">是否最新版本:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="isLastVersion" id="isLastVersion" <#if readonly?? >readonly=""</#if> class="required"  data-placeholder="Choose a State...">
                                                    <option value="1">是</option>
                                                    <option value="0">否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="minFirewareId">最小平台固件:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="minFirewareName" id="minFirewareName"  <#if readonly?? >readonly=""</#if> class="form-control col-sm-4 " value="${vo.minFirewareName!}"/>
                                            <input type="hidden" name="minFirewareId" id="minFirewareId"  <#if readonly?? >readonly=""</#if> class="form-control col-sm-4 " value="${vo.minFirewareId!}"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="maxFirewareId">最大平台固件:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="maxFirewareName" id="maxFirewareName"  <#if readonly?? >readonly=""</#if> class="form-control col-sm-4 " value="${vo.maxFirewareName!}"/>
                                            <input type="hidden" name="maxFirewareId" id="maxFirewareId"  <#if readonly?? >readonly=""</#if> class="form-control col-sm-4 " value="${vo.maxFirewareId!}"/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="adState">是否含广告:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="adState" id="adState" <#if readonly?? >readonly=""</#if>  data-placeholder="Choose a State...">
                                                    <option value="0">无广告</option>
                                                    <option value="1">有广告</option>
                                                    <option value="2">含恶意广告</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="safeState">安全级别:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="safeState" id="safeState" <#if readonly?? >readonly=""</#if>  data-placeholder="Choose a State...">
                                                    <#list safeStates as state>
                                                        <option value="${state.itemValue}" >
                                                            ${(state.itemTitle)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="resolution">分辨率尺寸值:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <input type="text" readonly="readonly"  name="resolutionShow" id="resolutionShow" class="form-control col-sm-4 required" value="${vo.resolutionShow!}"/>
                                                <input type="hidden"  name="resolution" id="resolution" class="form-control col-sm-4" value="${vo.resolution!}"/>

                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="payType">付费方式:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="payType" id="payType" <#if readonly?? >readonly=""</#if>  data-placeholder="Choose a State...">
                                                    <option value="0">免费</option>
                                                    <option value="1">付费</option>
                                                    <option value="2">限时免费</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="firstPublish">是否首发:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="firstPublish" id="firstPublish" <#if readonly?? >readonly=""</#if>  data-placeholder="Choose a State...">
                                                    <option value="0">否</option>
                                                    <option value="1">是</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="softSrc">软件来源:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="softSrc" id="softSrc" <#if readonly?? >readonly=""</#if> class="required" data-placeholder="Choose a State...">
                                                    <#list softSrcs as src>
                                                        <option value="${src.itemValue}" >
                                                            ${(src.itemTitle)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div>
                                        <label class="control-label col-xs-12 col-sm-2" for="permission">软件拥有的执行权限:</label>
                                        <div class="control-label col-xs-10 col-sm-10 " >
                                            <textarea  readonly="" class=" col-sm-10 limited" name="permission" id="permission" <#if readonly?? >readonly=""</#if>   maxlength="1000">${vo.permission!}</textarea>
                                        </div>
                                    </div>
                                </div>
                                <#if vo.state == 0 || vo.state == 4>
                                    <div class="form-group">

                                        <div>
                                            <label class="control-label col-xs-12 col-sm-2" for="checkReason">审核原因备注:</label>
                                            <div class="control-label col-xs-10 col-sm-10 " >
                                                <textarea class=" col-sm-10 limited" readonly=""  maxlength="1000" >${vo.checkReason!}</textarea>
                                            </div>
                                        </div>

                                    </div>
                                </#if>
                                <div class="form-group">
                                    <div>
                                        <label class="control-label col-xs-12 col-sm-2" for="updateDescription">版本更新介绍:</label>
                                        <div class="control-label col-xs-10 col-sm-10 " >
                                            <textarea class=" col-sm-10 " id="updateDescription" name="updateDescription"  <#if readonly?? >disabled="disabled"</#if> >${vo.updateDescription!}</textarea>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <input id="checkReason" name="checkReason" type="hidden" value="${vo.checkReason!}"/>
            <input id="adIconUrl" name="adIconUrl" type="hidden" value="${vo.adIconUrl!}"/>

            <input type="hidden" name="submitType" id="submitType">
            <input type="hidden" name="deviceTypeList" id="deviceTypeList">
            <#if !readonly??  >
                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <#if  vo.state == 1 || vo.state ==4 >
                            <button class="btn btn-info" type="button"  onclick="submitSoft(0)">
                                <i class="ace-icon fa fa-check bigger-110"></i> 提交审核
                            </button>
                        </#if>
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                            <button class="btn btn-info" type="button"  onclick="submitSoft(3)">
                                <i class="ace-icon fa fa-check bigger-110"></i> 直接发布
                            </button>
                        <#if vo.state == 1 >
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                            <button class="btn" type="button" onclick="submitSoft(1)">
                                <i class="ace-icon fa fa-undo bigger-110"></i> 存入草稿箱
                            </button>
                        </#if>
                        <#if vo.state == 0 >
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                            <button id = "bootbox-checkno" class="btn" type="button" >
                                <i class="ace-icon fa fa-trash-o bigger-110 orange"></i> 审核不通过
                            </button>
                        </#if>
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                            <button id = "bootbox-cancel" class="btn" type="button" >
                                <i class="ace-icon fa fa-stop bigger-110 orange"></i> 取消
                            </button>
                    </div>
                </div>
            </#if>
        </form>
</@mainlayout>
<script src="${ctx}/static/admin/assets/js/jquery.validate.js"></script>
<script src="${ctx}/static/admin/assets/js/jquery.validate.messages_zh.js"></script>
